export const list2tree = (data, id) => {
  if (typeof data !== 'object') return
  const tree = []
  data.length && data.forEach(item => {
    if (item.parentId === id) {
      tree.push(item)
      const children = list2tree(data, item.id)
      item.children = children
    }
  })
  return tree
}
